package cn.xiaolang.function.test_map;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;

import java.util.Map;

/**
 * 利用Guava工具包，使用3字段的Table表格
 *
 * @author Dean
 * @date 2023/5/15
 */
public class GoogleTableMapSample {


    public static void main(String[] args) {
        String modelKey = "A0000";
        System.out.println("Row of the " + modelKey + " exist: " + MODELS.containsRow(modelKey));
        Map<String, String> row = MODELS.row(modelKey);
        System.out.println("Row of the " + modelKey + " is: " + row);
    }

    // 等同于： Map<R, Map<C, V>>
    private static final Table<String, String, String> MODELS = HashBasedTable.create();

    static {
        MODELS.put("A0000", "name", "Dean");
        MODELS.put("A0001", "name", "Tom");
    }
}
